﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MyWeb.Business;
using MyWeb.Common;
namespace MyWeb
{
    public partial class Default1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                showtin();
            }
        }
        protected void showtin()
        {
            List<Data.GroupNews> list = GroupNewsService.GroupNews_GetByAll();
            if (list.Count > 0)
            {

                List<Data.News> lit = NewsService.News_GetByTop("1", "", "Id desc");
                for (int j = 0; j < lit.Count; j++)
                {
                    ltrnewss.Text += "<div class=\"cat-news twocol1 clearfix\">";
                    ltrnewss.Text += "<a href=\"/News/" + lit[j].GroupNewId + "/" + lit[j].Id + "/" + StringClass.NameToTag(lit[j].Name) + ".aspx\" title=\"" + lit[j].Name + "\"><img src=\"" + lit[j].Image + "\" alt=\"" + lit[j].Name + "\" title=\"" + lit[j].Name + "\" align=\"left\"></a>";
                    ltrnewss.Text += "<h4><a href=\"/News/" + lit[j].GroupNewId + "/" + lit[j].Id + "/" + StringClass.NameToTag(lit[j].Name) + ".aspx\" title=\"" + lit[j].Name + "\">" + lit[j].Name + "</a></h4>";
                    ltrnewss.Text += "<div class=\"clearfix\">" + lit[j].Content + "</div>";
                    ltrnewss.Text += "<div class=\"news-more\"><a href=\"/News/" + lit[j].GroupNewId + "/" + lit[j].Id + "/" + StringClass.NameToTag(lit[j].Name) + ".aspx\">Xem tiếp</a></div>";
                    ltrnewss.Text += "</div>";                    

                    List<Data.News> lst = NewsService.News_GetByTop("4", "Id not in(select top 1 Id from News Order by Id desc )", "Date desc");

                    if (lst.Count > 0)
                    {
                        ltrnewss.Text += "<div class=\"cat-morenews twocol2 clearfix\"><ul>";
                        for (int k = 0; k < lst.Count; k++)
                        {
                            ltrnewss.Text += "<li><a href=\"/News/" + lst[k].GroupNewId + "/" + lst[k].Id + "/" + StringClass.NameToTag(lst[k].Name) + ".aspx\" title=\"" + lst[k].Name + "\">" + lst[k].Name + "</a></li>";
                        }

                        ltrnewss.Text += "</ul></div> \n";
                        ltrnewss.Text += "<div class=\"clear\"></div>";  
                    }
                }
            }

        }
    }
}